<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : TrainDesc.xsl
    Created on : 2008年10月30日, 下午10:17
    Author     : Administrator
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
        <html>
            <head>
                <title>申城脉动车型:<xsl:value-of select="train/desc/name"/> 定义文件</title>
            </head>
            <body>
                <h1>描述</h1>
                <table border="1">
                    <TR>
                        <TD><B>车型</B></TD>
                        <TD><xsl:value-of select="train/desc/name"/></TD>
                    </TR>
                    <TR>
                        <TD><B>厂牌</B></TD>
                        <TD><xsl:value-of select="train/desc/band"/></TD>
                    </TR>
                    <TR>
                        <TD><B>类型</B></TD>
                        <TD>
                            <xsl:choose>
                                <xsl:when test="train/desc/type =1">
                                    A
                                </xsl:when>
                                <xsl:when test="train/desc/type =2">
                                    B
                                </xsl:when>
                                <xsl:when test="train/desc/type =3">
                                    C
                                </xsl:when>
                            </xsl:choose>
                        </TD>
                    </TR>
                    <TR>
                        <TD><B>简述</B></TD>
                        <TD><xsl:value-of select="train/desc/desc"/></TD>
                    </TR>
                    <TR>
                        <TD><B>配属线路</B></TD>
                        <TD><xsl:value-of select="train/desc/defaultLine"/>号线</TD>
                    </TR>
                    <TR>
                        <TD><B>全长</B></TD>
                        <TD><xsl:value-of select="train/desc/length"/>米</TD>
                    </TR>
                    <TR>
                        <TD><B>识别色</B></TD>
                        <TD>
                            <xsl:attribute name="bgcolor">
                               <xsl:value-of select="train/desc/defColor/r"/>
                               <xsl:value-of select="train/desc/defColor/g"/>
                               <xsl:value-of select="train/desc/defColor/b"/>
                            </xsl:attribute>
                        </TD>
                    </TR>
                </table>
                <h1>定义类</h1>
                <h3><xsl:value-of select="train/class"/></h3>
                <h1>音效绑定</h1>
                <table border="1">
                    <tr>
                        <td><b>关门</b></td>
                        <td><xsl:value-of select="train/sfx/doorClose"/></td>
                    </tr>
                    <tr>
                        <td><b>开门</b></td>
                        <td><xsl:value-of select="train/sfx/doorOpen"/></td>
                    </tr>
                </table>
                <h1>车门模型绑定</h1>
                <table border="1">
                    <tr>
                        <td><b>左门页</b></td>
                        <td><xsl:value-of select="train/door/doorAModel"/></td>
                    </tr>
                    <tr>
                        <td><b>右门页</b></td>
                        <td><xsl:value-of select="train/door/doorBModel"/></td>
                    </tr>
                    <tr>
                        <td><b>警示灯</b></td>
                        <td><xsl:value-of select="train/door/doorLightModel"/></td>
                    </tr>
                </table>
                
                <h1>编组</h1>
                <table border="1">
                    <thead>
                        <tr>
                            <td>车厢序号</td>
                            <td>车厢模型绑定</td>
                            <td>车厢偏移</td>
                            <td>转向架偏移</td>
                            <td>转向架模型绑定</td>
                            <td>车门偏移</td>
                        </tr>
                    </thead>
                    <tbody>
                        <xsl:for-each select="train/carriages/carriage">
                            <tr>
                                <td><xsl:value-of select="position()"/></td>
                                <td><xsl:value-of select="carriageModelKey"/></td>
                                <td><xsl:value-of select="offset"/></td>
                                <td>
                                    <table border ="1">
                                    <tr>
                                    <xsl:for-each select="bogieOffset">
                                        <td><xsl:value-of select="."/></td>
                                    </xsl:for-each>
                                    </tr>
                                    </table>
                                </td>
                                <td><xsl:value-of select="bogieModelKey"/></td>
                                <td>
                                    <table border ="1">
                                    <tr>
                                    <xsl:for-each select="doorOffset">
                                        <td><xsl:value-of select="."/></td>
                                    </xsl:for-each>
                                    </tr>
                                    </table>
                                </td>
                            </tr>
                        </xsl:for-each>
                    </tbody>
                </table>
            </body>
        </html>
    </xsl:template>

</xsl:stylesheet>
